using System.Collections.Generic;
using ProtoModels;

public struct MIntro
{
	public const int currentVersion = 4;

	public int version;

	public float timeStamp;

	public int myFlag;

	public string myName;

	public float eloRank;

	public int multiplayerWins;

	public int multiplayerLoses;

	public int level;

	public int opponentCoins;

	public string supportRoomNameGUID;

	public FloatRange remoteMoveSpeed;

	public FloatRange remoteJumpSpeed;

	public int remoteShotsToMinSpeed;

	public string remoteRacketId;

	public int remoteLookGender;

	public List<CharacterLookProperty> remoteLooks;

	public List<SkillLevel> remoteSkills;

	public string opponentPid;

	public float normalizedVisualSpeed;

	public string opponentImageUrl;

	public string shoeId;

	public PlayerPositions.PlayerPosition playerPosition;

	public void SetRoom(MultiplayerRooms.RoomInfo room)
	{
	}

	public static bool HasPidInIntro(int version)
	{
		return version >= 2;
	}

	public static bool CanUseSkillInfoScreen(int version)
	{
		return version >= 2;
	}

	public static bool ShouldSwitchStartingPlayerOnRematch(int version)
	{
		return version >= 2;
	}

	public static bool HasShoeId(int version)
	{
		return version >= 3;
	}

	public static bool HasPlayerPosition(int version)
	{
		return version >= 4;
	}

	public void Send(GGNetwork network)
	{
		network.BeginWrite(1);
		network.AddInt(version);
		network.AddFloat(timeStamp);
		network.AddInt(myFlag);
		network.AddString(myName);
		network.AddFloat(eloRank);
		network.AddInt(multiplayerWins);
		network.AddInt(multiplayerLoses);
		network.AddInt(level);
		network.AddInt(opponentCoins);
		network.AddString(supportRoomNameGUID);
		network.AddFloatRange(remoteMoveSpeed);
		network.AddFloatRange(remoteJumpSpeed);
		network.AddInt(remoteShotsToMinSpeed);
		network.AddString(remoteRacketId);
		network.AddInt(remoteLookGender);
		network.AddInt(remoteLooks.Count);
		for (int i = 0; i < remoteLooks.Count; i++)
		{
			network.AddInt(remoteLooks[i].activeIndex);
			network.AddInt(remoteLooks[i].type);
		}
		network.AddInt(remoteSkills.Count);
		for (int j = 0; j < remoteSkills.Count; j++)
		{
			network.AddFloat(remoteSkills[j].level);
			network.AddInt(remoteSkills[j].skillTypeInt);
			network.AddInt((int)remoteSkills[j].type);
		}
		network.AddString(opponentPid);
		network.AddFloat(normalizedVisualSpeed);
		network.AddString(opponentImageUrl);
		network.AddString(shoeId);
		bool flag = playerPosition != null;
		network.AddBool(flag);
		if (flag)
		{
			network.AddString(playerPosition.name);
			network.AddString(playerPosition.playerId);
			network.AddString(playerPosition.stars);
			network.AddString(playerPosition.country);
			network.AddString(playerPosition.imageUrl);
			network.AddString(playerPosition.score);
			network.AddInt(playerPosition.leadPositions.Count);
			foreach (PlayerPositions.PlayerPosition.LeadPosition leadPosition in playerPosition.leadPositions)
			{
				network.AddString(leadPosition.leadName);
				network.AddInt(leadPosition.leaderboardIndex);
				network.AddInt(leadPosition.totalInLead);
				bool flag2 = leadPosition.prize != null;
				network.AddBool(flag2);
				if (flag2)
				{
					network.AddInt(leadPosition.prize.prize_rank);
					network.AddInt(leadPosition.prize.prize_cash);
					network.AddInt(leadPosition.prize.prize_coins);
					network.AddString(leadPosition.prize.name);
					network.AddInt(leadPosition.prize.min_rank);
					network.AddInt(leadPosition.prize.max_rank);
					network.AddString(leadPosition.prize.min_rank_value_type);
					network.AddString(leadPosition.prize.max_rank_value_type);
					network.AddInt(leadPosition.prize.prize_group_id);
					network.AddString(leadPosition.prize.rewards);
				}
			}
		}
		network.EndWrite();
		network.Send(true, 0);
	}

	public void Deserialize(GGNetwork network)
	{
		version = network.GetInt();
		timeStamp = network.GetFloat();
		myFlag = network.GetInt();
		myName = network.GetString();
		eloRank = network.GetFloat();
		multiplayerWins = network.GetInt();
		multiplayerLoses = network.GetInt();
		level = network.GetInt();
		opponentCoins = network.GetInt();
		supportRoomNameGUID = network.GetString();
		remoteMoveSpeed = network.GetFloatRange();
		remoteJumpSpeed = network.GetFloatRange();
		remoteShotsToMinSpeed = network.GetInt();
		remoteRacketId = network.GetString();
		remoteLookGender = network.GetInt();
		remoteLooks = new List<CharacterLookProperty>();
		int @int = network.GetInt();
		for (int i = 0; i < @int; i++)
		{
			int int2 = network.GetInt();
			int int3 = network.GetInt();
			remoteLooks.Add(new CharacterLookProperty
			{
				activeIndex = int2,
				type = int3
			});
		}
		remoteSkills = new List<SkillLevel>();
		int int4 = network.GetInt();
		for (int j = 0; j < int4; j++)
		{
			float @float = network.GetFloat();
			int int5 = network.GetInt();
			SkillType int6 = (SkillType)network.GetInt();
			remoteSkills.Add(new SkillLevel
			{
				level = @float,
				skillTypeInt = int5,
				type = int6
			});
		}
		if (version >= 2)
		{
			opponentPid = network.GetString();
			normalizedVisualSpeed = network.GetFloat();
			opponentImageUrl = network.GetString();
		}
		if (version >= 3)
		{
			shoeId = network.GetString();
		}
		if (version < 4)
		{
			return;
		}
		if (network.GetBool())
		{
			playerPosition = new PlayerPositions.PlayerPosition();
			playerPosition.name = network.GetString();
			playerPosition.playerId = network.GetString();
			playerPosition.stars = network.GetString();
			playerPosition.country = network.GetString();
			playerPosition.imageUrl = network.GetString();
			playerPosition.score = network.GetString();
			playerPosition.leadPositions.Clear();
			int int7 = network.GetInt();
			for (int k = 0; k < int7; k++)
			{
				PlayerPositions.PlayerPosition.LeadPosition leadPosition = new PlayerPositions.PlayerPosition.LeadPosition();
				leadPosition.leadName = network.GetString();
				leadPosition.leaderboardIndex = network.GetInt();
				leadPosition.totalInLead = network.GetInt();
				if (!network.GetBool())
				{
					leadPosition.prize = null;
					continue;
				}
				leadPosition.prize = new Lead.Leaderboard.Prize();
				leadPosition.prize.prize_rank = network.GetInt();
				leadPosition.prize.prize_cash = network.GetInt();
				leadPosition.prize.prize_coins = network.GetInt();
				leadPosition.prize.name = network.GetString();
				leadPosition.prize.min_rank = network.GetInt();
				leadPosition.prize.max_rank = network.GetInt();
				leadPosition.prize.min_rank_value_type = network.GetString();
				leadPosition.prize.max_rank_value_type = network.GetString();
				leadPosition.prize.prize_group_id = network.GetInt();
				leadPosition.prize.rewards = network.GetString();
				playerPosition.leadPositions.Add(leadPosition);
			}
		}
		else
		{
			playerPosition = null;
		}
	}
}
